using Function.SerializedPropertyAttribute;
using UnityEngine;

#if UNITY_EDITOR
using UnityEditor;

[CustomEditor(typeof(CustomDraw))]
public class CustomDrawEditor : ObjectDrawEditor<CustomDraw>
{
}
#endif

public class CustomDraw : MonoBehaviour
{
    public enum AIState
    {
        None,
        Walk,
        RUn,
    }

    [Foldout("SConditionalField", true)] public AIState State = AIState.None;

    [ConditionalField(nameof(State), false, AIState.Walk, AIState.RUn)]
    public int enumCondition;

    public bool booeaaa;

    [ConditionalField(nameof(booeaaa), false)]
    public int bbb;

    [Foldout("SDefinedValues", true)] [DefinedValues("Hello", "World", "aaa")]
    public string IsItHelloOrWorld;

    [DefinedValues(true, 1, "1", 2, "2")] public int Test;

    [DefinedValues(true, true, "true", false, "false")]
    public bool testBool;


    [DefinedValues(nameof(TransformTest))] public Transform ChildReference;

    private Transform[] TransformTest()
    {
        var childs = transform.GetChilds();
        childs.Insert(0, null);
        return childs.ToArray();
    }


    [Foldout("SReadOnly", true)] [ReadOnly]
    public string ReadyOnly = "niubi";


    [Foldout("SSpriteLayer", true)] [SpriteLayer]
    public int spriteLayer;

    [Layer] public int layer;

    [Tag] public string tag;


    [Foldout("SMustBeAssigned", false)] [MustBeAssigned]
    public Transform _hastransform;

    [Foldout("SMustBeAssigned", false)] [MustBeAssigned]
    public Transform _nottransform;


    // [SSeparator("title", true)] public int _testTitle;
    //
    // [SSeparator("asda", false)] public int _testTitle1;
    //
    // [SSeparator] public int _testTitle2;

    [ButtonMethod]
    void Save()
    {
        "Save".Log();
    }
}